const Koa = require("koa")
const views = require("koa-views")
const mongoose = require("mongoose")
const {resolve} = require('path')
const {connect,initSchema} = require('./database/init')

const app = new Koa()

;(async () => {
    await connect()
    initSchema()
    require('./tasks/movie')
})()

app.use(views(resolve(__dirname,'./views'),{
    extension:'pug'
}))

app.use(async(ctx,next)=>{
    await ctx.render('index',{
        you:'like',
        me: 'scort'
    })
})

app.listen(4455);